<template>
	<view class="uiwu">
		<uiwu-list :loading="more">
			<view class="uiwu-list">
				<view class="uiwu-list-item uiwu-flex-space" v-for="(item,index) in listData" :key="index">
					<view style="flex: 1;" class="uiwu-flex-column in">
						<text>订单号：{{item.order_id}}</text>
						<text>{{uiwu.formatTimestamp(item.add_time * 1000)}}</text>
					</view>
					<view class="money">￥{{item.pay_price}}</view>
				</view>
			</view>
		</uiwu-list>
	</view>
</template>

<script setup lang="ts">
	import { onLoad , onReachBottom } from '@dcloudio/uni-app';
	import { ref } from 'vue';
	import { memberrecirdlist } from '@/api/api';
	import { uiwu } from '@/config/config';
	const listData = ref<Array<object>>([])
	const pageNum = ref<number>(1)
	const more = ref<string>('loading');
	const isLock = ref<boolean>(true)
	const getmemberrecirdlist = async (mack:boolean=false) : Promise<any> => {
		if(!mack) pageNum.value = 1
		const { data:{data , total}} = await memberrecirdlist({
			page:pageNum.value,
		});
		isLock.value = true
		uiwu.setlist({
			isMore:mack,
			listData,
			total,
			listRow:data,
			more,
			pageNum
		})
	}
	/**
	 * 加载更多
	 */
	onReachBottom(()=>{
		if(!isLock.value) return 
		isLock.value = false
		pageNum.value++
		getmemberrecirdlist(true)
	})
	onLoad(()=>{
		getmemberrecirdlist()
	})
</script>

<style lang="scss">
	page{
		background-color: #F6F6F6;
	}
	.uiwu-list{
		padding: 24rpx 24rpx 0;
		&-item{
			background-color: #fff;
			border-radius: 20rpx;
			margin-bottom: 20rpx;
			padding: 24rpx;
			.in{
				text{
					&:nth-child(1){
						font-size: 28rpx;
						color: #333;
					}
					&:nth-child(2){
						font-size: 24rpx;
						color: #777;
						margin-top: 10rpx;
					}
				}
			}
			.money{
				color: #EF821E;
				font-size: 32rpx;
				font-weight: 500;
			}
		}
	}
</style>
